SoftAction Resource Files
Archived from http://www.cinnamonpirate.com/docs/softactionres on 2006/2/7
Grudgingly copied and pasted from his browser by D

These files are used in some games by Korean publisher SoftAction SDT. More specifically, they are used in SoftAction’s Langrisser I&II remakes–where I encountered them. Their extension is .RES.

SoftAction Resource Files are just another package format very similar to Microsoft Fastfile. They were designed to speed up games depending on DirectX 6.0.

The file begins with a long value telling the file count, then loops through a file table based on DOS 8.3 file names.

Surprisingly, despite being used to stream data off the game CD, the files aren’t padded out to begin at even sectors.

The file loop is detailed below. All values are stored in little endian ordering, and strings are padded by 0×00:

File count [4 bytes, long]
(File loop)
  File name [16 bytes, string]
  File offset [4 bytes, long]
  File size [4 bytes, long]
(End loop)
(Data)

A proof of method to extract a resource file is shown below:

$fd = fopen('tdat.res', 'rb');
$count = unpack('V*', fread($fd, 4));
$filename = array();
$offset = array();
$size = array();
for($i=0; $i< $count; $i++) {
  $filename[$i] = rtrim(fread($fd, 16));
  $offset[$i] = unpack('V*', fread($fd, 4));
  $size[$i] = unpack('V*', fread($fd, 4));
}
for($i=0; $i<$count; $i++) {
  fseek($fd, $offset[$i], SEEK_SET);
  $fo = fopen($filename[$i], 'w');
  fputs($fo, fread($fd, $size[$i]));
  fcolse($fo);
}
fclose($fd);